#pragma once
#include "objpool.hpp"

namespace MyMemory
{
    template <class T>
    CObjPool<T>& GetPool(void)
    {
        static CObjPool<T> m_pool;
        return m_pool;
    }

    template<class T>
    T* NewObj(void)
    {
        return GetPool<T>().AllocObj();
    }

    template<class T>
    void DeleteObj(T* obj)
    {
        GetPool<T>().FreeObj(obj);
    }

    template<class T>
    T* RawNew(void)
    {
        return new T;
    }

    template<class T>
    T* RawNewArry(size_t count)
    {
        return new T[count];
    }

    template<class T>
    void RawDelete(T* obj)
    {
        delete obj;
    }

    template<class T>
    void RawDeleteArry(T* obj)
    {
        delete[] obj;
    }
}